package com.treasure.mall.biz.repository.marketing;

import com.treasure.mall.biz.base.JpaSearchableRepository;
import com.treasure.mall.biz.entity.marketing.UserSignInPO;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;

/**
 * @author allan
 * @version 1.0.0
 * @date 2020/8/22
 */
@Repository
public interface UserSignInRepository extends JpaSearchableRepository<UserSignInPO, Long> {
    UserSignInPO findByUserIdAndSignDate(Long userId, LocalDate date);

    boolean existsByUserIdAndSignDate(Long userId, LocalDate date);

    List<UserSignInPO> findByUserIdAndSignDateBetween(Long userId, LocalDate begin, LocalDate end);

    UserSignInPO findTopByUserIdAndSignDateBeforeOrderBySignDateDesc(Long userId, LocalDate date);
}
